package remote.controls
{
	import remote.geom.EdgeMetrics;
	
	/**
	 * 进度基类，可扩展为进度条及各种开关的进度
	 * @author 银魂飞雪
	 * @createDate 2011-4-13
	 */
	public class ProgressBase extends Component
	{
		private var _value:Number;
		private var _maxValue:Number;
		

		public function ProgressBase()
		{
			super();
		}
		
		override protected function initProperty():void
		{
			super.initProperty();
			_value = 0;
			_maxValue = 100;
		}
		
		/**
		 * 设置进度 
		 * @param value 当前值
		 * @param maxValue 最大值
		 * 
		 */		
		public function setProgress(value:Number, maxValue:Number):void
		{
			if(value > maxValue)
				value = maxValue;
			if(_value != value || _maxValue != maxValue)
			{
				_value = value;
				_maxValue = maxValue;
			}
		}
		
		public function get percent():Number
		{
			return value * 100 / maxValue;
		}
		
		public function get maxValue():Number
		{
			return _maxValue;
		}
		
		public function get value():Number
		{
			return _value;
		}
	}
}